package com.glsc.ngateway.oaflow.utils;

import com.glsc.ngateway.common.api.common.enums.GatewayConstant;

import java.util.HashMap;
import java.util.Map;

/**
 * @Title: FanweiSupport
 * @Description: 泛微支持类
 * @author: 张宁
 * @version: 1.0.0
 * @date: 2020/12/21 16:29
 */


public class FanweiSupport {


    public static Map<String, String> mapChange(String result) {

        result = result.replace("{", "").replace("}", "").replace("\"", "");
        Map<String, String> map = new HashMap<String, String>();
        String[] tmps = result.split(",");
        for (String tmp : tmps) {
            if (tmp.contains(":")) {
                String[] resultArray = tmp.split(":");
                if (resultArray.length == 2) {
                    if (resultArray[0].equals(GatewayConstant.FANWEI_REQUEST_ID) || resultArray[0].equals(GatewayConstant.FANWEI_MSG)) {
                        map.put(resultArray[0], resultArray[1]);
                    }
                }
            }
        }
        return map;
    }
}
